import 'package:duqing/config/app_colors.dart';
import 'package:duqing/utils/util.dart';
import 'package:flutter/material.dart';

class CommentLikeRead extends StatelessWidget {
  final int commentCount;
  final int thumbUpCount;
  final int readCount;

  const CommentLikeRead({
    Key key,
    this.commentCount,
    this.thumbUpCount,
    this.readCount,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Row(
      children: [
        _iconText(
          'assets/images/icons/comment.png',
          commentCount,
        ),
        _iconText(
          'assets/images/icons/like.png',
          thumbUpCount,
        ),
        _iconText(
          'assets/images/icons/read.png',
          readCount,
        ),
      ],
    );
  }

  Widget _iconText(String icon, int count) {
    return Expanded(
        flex: 1,
        child: Row(
          children: [
            Image.asset(
              icon,
              width: 14,
              height: 14,
            ),
            const SizedBox(
              width: 4,
            ),
            Expanded(
              flex: 1,
              child: Text(
                formatCharCount(count),
                maxLines: 1,
                overflow: TextOverflow.ellipsis,
                style: const TextStyle(
                  color: AppColors.un3active,
                  fontSize: 12,
                ),
              ),
            ),
          ],
        ));
  }
}
